<template>
	<input type="text" v-model="name"/>
	<input type="password"  v-model="password"/>
	<div class="submitBtn" @click="login">
		登录
	</div>
</template>

<script setup>
	import {ref} from 'vue'
	import http from './request.js'
	import {useRouter} from 'vue-router'
	const router = useRouter()
	const name = ref('')
	const password = ref('')
	function login(){
		http.post('/login',{name:name.value,password:password.value}).then(res=>{
			// console.log(res.data.code)
			// let data = JSON.parse(res.data);
			if(res.data.code==200){
				router.push('/')
			}
		})
	}
</script>

<style>
	.submitBtn{
		width:300px;
		height:100px;
		border-radius:30px;
		background:royalblue;
		color:#fff;
		text-align:center;
		line-height:100px;
	}
</style>